﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Corss_LehaKondr
{
    public class Cell:ContentControl
    {
        public bool isAnswerStart
        {
            get { return (bool)GetValue(isAnswerStartProperty); }
            set { SetValue(isAnswerStartProperty, value); }
        }

        // Using a DependencyProperty as the backing store for isAnswerStart.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty isAnswerStartProperty =
            DependencyProperty.Register("isAnswerStart", typeof(bool), typeof(Cell), new PropertyMetadata(false));
        
        public uint AskNumber
        {
            get { return (uint)GetValue(AskNumberProperty); }
            set { SetValue(AskNumberProperty, value); }
        }

        // Using a DependencyProperty as the backing store for AskNumber.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty AskNumberProperty =
            DependencyProperty.Register("AskNumber", typeof(uint), typeof(Cell), new PropertyMetadata((uint)1));
        
        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(Cell), new PropertyMetadata(string.Empty));



        public bool isUsable
        {
            get { return (bool)GetValue(isUsableProperty); }
            set { SetValue(isUsableProperty, value); }
        }

        // Using a DependencyProperty as the backing store for isUsable.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty isUsableProperty =
            DependencyProperty.Register("isUsable", typeof(bool), typeof(Cell), new PropertyMetadata(true,new PropertyChangedCallback((obj,e)=>
                {
                    obj.SetValue(isUnusablePropertyKey, !(bool)e.NewValue);
                })));


        // Using a DependencyProperty as the backing store for isUnusable.  This enables animation, styling, binding, etc...
        protected static readonly DependencyPropertyKey isUnusablePropertyKey =
            DependencyProperty.RegisterReadOnly("isUnusable", typeof(bool), typeof(Cell), new PropertyMetadata(false));
        public static readonly DependencyProperty isUnusableProperty = isUnusablePropertyKey.DependencyProperty;

        
        public bool ShowInsertMask
        {
            get { return (bool)GetValue(ShowInsertMaskProperty); }
            set { SetValue(ShowInsertMaskProperty, value); }
        }

        // Using a DependencyProperty as the backing store for ShowInsertMask.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ShowInsertMaskProperty =
            DependencyProperty.Register("ShowInsertMask", typeof(bool), typeof(Cell), new PropertyMetadata(false));
        
        public Brush InsertMask
        {
            get { return (Brush)GetValue(InsertMaskProperty); }
            set { SetValue(InsertMaskProperty, value); }
        }

        // Using a DependencyProperty as the backing store for InsertMask.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty InsertMaskProperty =
            DependencyProperty.Register("InsertMask", typeof(Brush), typeof(Cell), new PropertyMetadata(null));
        
        public bool ShowGoodInsertMask
        {
            get { return (bool)GetValue(ShowGoodInsertMaskProperty); }
            set { SetValue(ShowGoodInsertMaskProperty, value); }
        }

        // Using a DependencyProperty as the backing store for ShowGoodInsertPoint.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ShowGoodInsertMaskProperty =
            DependencyProperty.Register("ShowGoodInsertMask", typeof(bool), typeof(Cell), new PropertyMetadata(false));



        public Brush GoodInsertMask
        {
            get { return (Brush)GetValue(GoodInsertMaskProperty); }
            set { SetValue(GoodInsertMaskProperty, value); }
        }

        // Using a DependencyProperty as the backing store for GoodInsertBrush.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty GoodInsertMaskProperty =
            DependencyProperty.Register("GoodInsertMask", typeof(Brush), typeof(Cell), new PropertyMetadata(null));

        

        /// <summary>
        /// DependencyProperty for <see cref="FontSize" /> property.
        /// </summary> 
        //[CommonDependencyProperty]
        public static readonly DependencyProperty FontSizeNumberProperty =
                DependencyProperty.RegisterAttached(
                        "FontSizeNumber",
                        typeof(double),
                        typeof(Cell),
                        new FrameworkPropertyMetadata(
                                6.667 ,
                                FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits));

        /// <summary> 
        /// The FontSize property specifies the size of the font.
        /// </summary> 
        [TypeConverter(typeof(FontSizeConverter))]
        [Localizability(LocalizationCategory.None)]
        public double FontSizeNumber
        {
            get { return (double)GetValue(FontSizeNumberProperty); }
            set { SetValue(FontSizeNumberProperty, value); }
        }

      
    }
}
